


import formula.calculator.R;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;

public class Physics extends Activity {

        @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.physics_activity);
    }
        
        public void onClick(View v) {
                Intent i = null;
                switch(v.getId()) {
                        case R.id.kinematic:
                                i = new Intent(this, KinematicEquation.class);
                                break;
                        case R.id.temperature:
                                i = new Intent(this, TemperatureConversion.class);
                                break;
                        case R.id.ohms:
                                i = new Intent(this, Voltage.class);
                                break;
                        case R.id.momentum:
                                i = new Intent(this, Momentum.class);
                                break;
                        case R.id.energy:
                                i = new Intent(this, Energy.class);
                                break;
                }
                if(i != null) {
                        startActivity(i);
                }
        }
        
        
        /****           Potential Energy due to Gravity         ****/
        /***            Pe = mgh                ***/
        
        private double potentialEnergy(double mass, double gravity, double height) {
                double result = mass * gravity * height;
                return result;
        }
        
        private double potentialEnergyM(double potentialEnergy, double gravity, double height) {
                double result = potentialEnergy / (gravity * height);
                return result;
        }
        
        private double potentialEnergyG(double potentialEnergy, double mass, double height) {
                double result = potentialEnergy / (mass * height);
                return result;
        }
        
        private double potentialEnergyH(double potentialEnergy, double mass, double gravity) {
                double result = potentialEnergy / (mass * gravity);
                return result;
        }
        
        
        /****           Kinetic Energy          ****/
        /***            KE = 1 / 2 mv^2         ***/
        
        private double kineticEnergy(double mass, double velocity) {
                double result = 1 / 2 * mass * (velocity * velocity);
                return result;
        }
        
        private double kineticEnergym(double kineticEnergy, double velocity) {
                double result = (kineticEnergy * 2) / (velocity * velocity);
                return result;
        }
        
        private double kineticEnergyv(double kineticEnergy, double mass) {
                double result = Math.sqrt((kineticEnergy * 2) / mass);
                return result;
        }
        
        
        /****           Potential Energy due to electricity                     ****/
        /***            PE = 1 / 2 * k * x^2            ***/
        
        private double electricPotentialEnergy(double springConstant, double displacement) {
                double result = 1 / 2 * springConstant * (displacement * displacement);
                return result;
        }
        
        private double electricPotentialEnergyk(double potentialEnergy, double displacement) {
                double result = (potentialEnergy * 2) / (displacement * displacement);
                return result;
        }
        
        private double electricPotentialEnergyx(double potentialEnergy, double springConstant) {
                double result = Math.sqrt((potentialEnergy * 2) / springConstant);
                return result;
        }
        
        
        
        
        private double ohmsLawV(double current, double resistance) {
                double result = current * resistance;
                return result;
        }
        
        private double ohmsLawI(double voltage, double resistance) {
                double result = voltage / resistance;
                return result;
        }
        
        private double ohmsLawR(double voltage, double current) {
                double result = voltage / current;
                return result;
        }
        
        private double momentumP(double mass, double velocity) {
                double result = mass * velocity;
                return result;
        }
        
        private double momentumM(double momentum, double velocity) {
                double result = momentum / velocity;
                return result;
        }
        
        private double momentumV(double momentum, double mass) {
                double result = momentum / mass;
                return result;
        }
}
